//
// Created by ashCheng on 2023/2/1.
// 1.6
#include <iostream>
#include <string>

struct Sales_data {
  std::string bookNo;
  unsigned units_sold = 0;
  double revenue = 0.0;
};

int main() {
  Sales_data total;
  double total_price;
  if (std::cin >> total.bookNo >> total.units_sold >> total_price) {
    total.revenue = total.units_sold * total_price;
    Sales_data trans;
    double trans_price;
    while (std::cin >> trans.bookNo >> trans.units_sold >> trans_price) {
      trans.revenue = trans.units_sold * trans_price;
      if (total.bookNo == trans.bookNo) {
        total.units_sold += trans.units_sold;
        total.revenue += trans.revenue;
      }else {
        std::cout << total.bookNo << " " << total.units_sold << " " << total.revenue;
        total = trans;
      }
    }
    std::cout << total.bookNo << " " << total.units_sold << " " << total.revenue << " ";
    if (total.units_sold != 0) {
      std::cout << total.revenue / total.units_sold << std::endl;
    } else {
      std::cout << "No sales!" << std::endl;
    }
  }else {
    std::cerr << "No data?!" << std::endl;
    return -1;
  }
  return 0;
}